import * as types from '../mutation-types'
// initial state
// shape: [{ id, quantity }]
const state = {
  filterNav: []
}

// getters
const getters = {
  filterNav: state => state.filterNav
}

// actions
const actions = {
  setFilterNav ({ commit, state }, filter) {
    commit(types.HIDE_NAV, filter)
  }
}

// mutations
const mutations = {
  [types.HIDE_NAV] (state, filter) {
    if (state.filterNav.indexOf(filter) < 0) {
      state.filterNav.push(filter)
      state.filterNav.push(filter)
    }
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
